#!/usr/bin/python
# -*- coding: utf-8 -*-

#Author: Yuanhao Li <jay_21cn@hotmail.com>
#File: ingcinfobase.py
#Usage: Client of ING from project Babel
#Copyright (C) 2007 Yuanhao Li<jay_21cn@hotmail.com>

#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software Foundation,
#Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#本程序是遵从 GPL 2.0 许可发布的. 你可以自由修改和再发布本程序, 
#但请遵守 GPL 2.0 条款, 尊重知识产权.

import time, sys, os

from PyQt4.QtCore import QString

from PyQt4 import QtCore

cwd = os.path.split(sys.argv[0])[0]
if not cwd:
	cwd = os.getcwd()

def getDate():
	return time.strftime("%H:%M:%S", time.localtime())

class IngcDisplayTemplate():
# $alternatecolor_qwer1234 -> bgcolor[ #f5f5f5 | #dfeff3 ]
# $displaypicture_qwer1234 -> displaypicture for user
# $nickname_qwer1234 -> nickname
# $content_qwer1234 -> content
# $date_qwer1234 -> date
	def __init__(self):
		self.text = QString('<div><table cellspacing="5" bgcolor="$alternatecolor_qwer1234" width="100%" border="0"><tr><td width="1"><img src="pixmaps/space.png" height="5" width="50"><table cellpadding="1" bgcolor="#eeeeee" border="0"><tr><td><a href = "$userprofileurl_qwer1234">$displaypicture_qwer1234</a></td></tr></table></td><td><table width="100%" border="0"><tr><td><span style="color: $idcolor_qwer1234; font-weight: bold;">$nickname_qwer1234: </span><span style = "color: $contentcolor_qwer1234;">$content_qwer1234</span></td></tr><tr><td><div><img src="pixmaps/space.png" height="20"></div><span style="color: #cccccc;">$date_qwer1234</span></td></tr></table></td></tr></table></div>')

		self.systext = QString('<div><center><table cellspacing="6" width = "100%" border = "0"><tr><td bgcolor = "#666666" width = "2"> </td><td><span style="color: #666666;"><b>INGC: </b>$contentcolor_qwer1234</span></td></tr></table></center></div>')

	def getTemplate(self):
		return self.text

	def getSysTemplate(self):
		return self.systext

IngcUserAgent = 'INGC/0.10'
#alternatecolor
IngcEntryColor1 = QString(u'#ffffff')
IngcEntryColor2 = QString(u'#edf3fe')
#highlightbgcolor
IngcEntryColor3 = QString(u'#3875d7')
#id_others_color
IngcEntryColor4 = QString(u'#1d8a00')
IngcEntryColor5 = QString(u'#881c1c')
#contentcolor
IngcEntryColor6 = QString(u'#000000')
IngcEntryColor7 = QString(u'#ffffff')

IngcStartIntro = u'<table cellspacing = "10" border = "0"><tr><td><div><center><img src="pixmaps/ingclogo.png"></center></div><p><center><h3> - Ver 0.10 Beta - </h3></center></p><p>INGC 是 <a href = "http://livid.cn"><span style = "color: #b06708;">Livid</span></a> 的开源项目 <a href = "http://code.google.com/p/project-babel"><span style = "color: #b06708;">Babel</span></a> - <a href = "http://www.v2ex.com/ing"><span style = "color: #b06708;">ING</span></a> 的通用客户端. INGC 的 C 有 Client, Chat, Console 的意思, 同时 INGC 又谐音 Ink. 他可以把你和与你志同道合的朋友们粘在同一片天空下.</p><p><h3>使用说明:</h3>在登录状态下, 输入 help 可获得可用命令列表. 登录窗口里面的代理为可选项, 格式为: <i>123.123.123.123:8080</i> , 目前只支持 Http 匿名代理.</p><p> INGC 主页: <a href="http://code.google.com/p/ingc/"><span style = "color: #b06708;">http://code.google.com/p/ingc</span></a></p><p>如果你在使用中发现了 Bug 或者有好的建议都可以发布在 <a href="http://www.v2ex.com"><span style = "color: #b06708;">V2EX</span></a>.</p><p>&nbsp;</p><p> - <a href = "http://thatssky.spaces.live.com"><span style = "color: #b06708;">李元昊</span></a> [V2EX ID: <a href = "http://www.v2ex.com/u/Jay"><span style = "color: #b06708;">Jay</span></a>] - </p></td></tr></table>'

IngcViewStartLoginMessage = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'正在登录...', 'date':getDate()}


IngcLoginSuccess = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'登录成功.', 'date':getDate()}

IngcLoginFailed= {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'登录失败, 可能是网络原因, 也可能是登录所需的信息错误. 检查一下输入看看是否正确.', 'date':getDate()}

IngcDisconnect = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'已经和服务器断开连接.', 'date':getDate()}

IngcReconnect = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'和服务器重新建立连接.', 'date':getDate()}

IngcHelp = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'搞不懂你也, 输入 help 获取帮助信息.', 'date':getDate()}

IngcHelpText = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'<br>命令列表: <br>"ingc 信息" - 发布 ING; <br>"me" - 只显示自己的 ING; <br>"friends" - 显示自己和朋友们的 ING; <br>"everyone" - 显示所有人的 ING; <br>"hot" - 显示当前活跃主题; <br>"period 秒数" - 设置读取 ING 的周期, 后面跟自然数, 单位为秒; <br>"font" - 设置显示字体; <br>"help" - 显示本年度最佳帮助信息.', 'date':getDate()}

IngcChangeToMe = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'现在只显示来自自己的 ING.', 'date':getDate()}

IngcChangeToFriends = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'现在只显示来自自己和朋友的 ING.', 'date':getDate()}

IngcChangeToEveryone = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'现在显示所有人的 ING.', 'date':getDate()}

IngcIngTooBig = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'检查一下输入 ING 的大小.', 'date':getDate()}

IngcJay = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'谁? 哦! Jay 是一个光头大帅哥.', 'date':getDate()}

IngcParseNewItemsError = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'读取服务器信息出错, 自动断开和服务器的连接, 可以尝试重新连接解决此问题.', 'date':getDate()}

IngcAddIngTimeOut = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'添加 ING 超时, 可能网络有问题.', 'date':getDate()}

IngcUpdateError = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'Ooops... period 命令的格式为: period 秒数(为自然数)', 'date':getDate()}

IngcFontError = {'userDisplayPicture':'', 'userNickname':'INGC Robot', 'content':u'字体设置出错, 再试试?! ',' date':getDate()}
#for testcase
test = {'userDisplayPicture':'', 'userNickname':'INGC Robo...', 'content':QString(u'@INGC Robo..., 正在登录....aaa'), 'date':getDate()}
